﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace ERP_RORZE_TOOL.Tool.NGNoibo
{
    public partial class frmDateInput : DevExpress.XtraEditors.XtraForm
    {
        ucGridView parent;
        public frmDateInput(ucGridView uc)
        {
            InitializeComponent();
            parent = uc;
            this.CancelButton = this.btCancel;

            DateTime lastDayLastMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            dateInput.EditValue = lastDayLastMonth.AddDays(-1);
        }

        private void btView_Click(object sender, EventArgs e)
        {
            if (dateInput.EditValue == null || dateInput.EditValue.ToString() == "")
            {
                MessageBox.Show(ReportConstants.Message.DateIsNotNull, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dateInput.Focus();
                return;
            }
            parent.dateInput = DateTime.Parse(dateInput.EditValue.ToString());
            parent.BindDataToGridviewInput(ReportConstants.ReportId.FNGCu_Moi);
            this.Dispose();
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}